<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    
    <!-- PHP CODE! -->
    
    <?php
        $campos = array(
            "login" => "Login",
            "senha" => "Senha"
        );
    
        include("conecta.php");
    
        if(isset($_POST['submit'])) {
            $values = array();
            
            foreach($campos AS $campo=>$label){
                $values[$campo] = ($_POST[$campo]);
            }
            
            $sql = "INSERT INTO usuario (login,senha) VALUES ('".$values['login']."', '".$values['senha']."');";
            $result = mysql_query($sql);
            if($result) {
                echo "Cadastro efetuado!";
            }
            else {
                echo "Erro!";
            }
            
            mysql_close();
        }
        
    ?>
    
    <!-- PHP CODE! -->
        
    <body>
        <h1> Cadastrar </h1>
        <form action="cadastro.php" method="post">
            Login: <input type="text" name="login" />
            Senha: <input type="password" name="senha" />
            <input type="submit" name="submit" value="Enviar" />
        </form>
    </body>
</html>
